<template>
  <div class="boxc">
    <!-- 头部 -->
    <div class="htear">
      <div class="left">
        <div
          @click="$router.go(-1)"
          class="return iconfont icon-arrowRight-copy-copy"
        ></div>
        <div class="name">分类</div>
      </div>
      <div class="age">
        <router-link tag="div" to="/schoolboy" class="com">男生</router-link>
        <router-link tag="div" to="/girlstudent">女生</router-link>
      </div>
      <div class="right">
        <router-link tag="div" to="/search" class="searchcon iconfont icon-31sousuo"></router-link>
        <div
          is-link
          @click="showPopup"
          class="classification iconfont icon-a-gengduofenlei"
        ></div>
      </div>
    </div>
    <!-- 弹出内容 -->
    <van-popup
      closeable
      v-model="show"
      position="top"
      :style="{ height: '45%' }"
    >
      <div class="boxpopup">
        <!-- 头部 -->
        <div class="htears">
          <div class="left">
            <div
              @click="$router.go(-1)"
              class="return iconfont icon-arrowRight-copy-copy"
            ></div>
            <div class="name">分类</div>
          </div>
        </div>
        <!-- 分类 -->
        <div class="guide-nav">
          <router-link tag="div" to="/schoolboy" class="box">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-home-copy"></use>
            </svg>
            <div class="boxtext">首页</div>
          </router-link>
          <router-link tag="div" to="/classification" class="box">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-fenlei"></use>
            </svg>
            <div>分类</div>
          </router-link>
          <router-link tag="div" to="/rankinglist" class="box">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-daochu1024-02"></use>
            </svg>
            <div>排行榜</div>
          </router-link>
          <router-link tag="div" to="/cover" class="box">
            <svg class="icon" aria-hidden="true">
              <use
                xlink:href="#icon-a-travelhotelholidayvacationcdlistingboo"
              ></use>
            </svg>
            <div>免费</div>
          </router-link>
          <router-link tag="div" to="/end" class="box">
            <svg class="icon sw" aria-hidden="true">
              <use xlink:href="#icon-wanjietuijian"></use>
            </svg>
            <div>完本</div>
          </router-link>
          <router-link tag="div" to="/okami" class="box">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-huangguan"></use>
            </svg>
            <div>大神</div>
          </router-link>
        </div>
        <!-- 我的书架 -->
        <router-link tag="div" to="/bookshelf" class="mybookshelf">我的书架</router-link>
      </div>
    </van-popup>
    <!-- 内容 -->
    <div class="content">
      <div v-for="(item,index) in classlists" :key="index" class="classcontent">
        <div class="topnav">
          <div class="name">{{item.name}}</div>
          <span>共 {{item.num}}本作品</span>
          <router-link tag="div" :to="'/lightnovel?name=' + item.name" class="iconfont icon-arrowRight-copy-copy-copy"></router-link>
        </div>
        <div class="classlabel">
          <ul>
            <router-link tag="li" :to="'/lightnovel?name=' + v" v-for="(v,i) in item.lists" :key="i">{{v}}</router-link>
          </ul>
        </div>
      </div>
    </div>
    
  </div>
</template>

<script>
export default {
  data() {
    return {
      show: false, //弹出判断
      classlists:[{
        name:"玄幻",
        num:721722,
        lists:[
          "东方玄幻",
          "异世大陆",
          "王朝争霸",
          "高武世界"
        ]

      },{
        name:"玄幻",
        num:159241,
        lists:[
          "现代魔法",
          "剑与魔法",
          "史诗奇幻",
          "神秘幻想",
          "历史神话",
          "另类幻想",
        ]

      },{
        name:"玄幻",
        num:721722,
        lists:[
          "东方玄幻",
          "异世大陆",
          "王朝争霸",
          "高武世界"
        ]

      },{
        name:"玄幻",
        num:159241,
        lists:[
          "现代魔法",
          "剑与魔法",
          "史诗奇幻",
          "神秘幻想",
          "历史神话",
          "另类幻想",
        ]

      },{
        name:"玄幻",
        num:721722,
        lists:[
          "东方玄幻",
          "异世大陆",
          "王朝争霸",
          "高武世界"
        ]

      },{
        name:"玄幻",
        num:159241,
        lists:[
          "现代魔法",
          "剑与魔法",
          "史诗奇幻",
          "神秘幻想",
          "历史神话",
          "另类幻想",
        ]

      },{
        name:"玄幻",
        num:721722,
        lists:[
          "东方玄幻",
          "异世大陆",
          "王朝争霸",
          "高武世界"
        ]

      },{
        name:"玄幻",
        num:159241,
        lists:[
          "现代魔法",
          "剑与魔法",
          "史诗奇幻",
          "神秘幻想",
          "历史神话",
          "另类幻想",
        ]

      }]
    };
  },
  methods: {
    //头部弹出
    showPopup() {
      this.show = true;
    },
  },
  created(){
    this.$axios.get("/static.json").then((res) => {
      let data = res.data;
      this.classlists = data.classlists//分类数据列表
    })
  }
};
</script>

<style lang="less">
.boxc {
  // 关闭按钮
  .van-popup__close-icon--top-right {
    top: 13px;
  }
  .boxpopup {
    .htears {
      width: 100%;
      display: flex;
      height: 22px;
      padding: 11px 0px 10px 0px;
      justify-content: space-between;
      align-items: center;
      .age {
        display: flex;
        height: 24px;
        border: 1px solid #ed424b;
        border-radius: 3px;
        div {
          font-size: 15px;
          line-height: 24px;
          color: #ed424b;
          padding: 0px 10px;
        }
        .com {
          background: #ed424b;
          color: white;
        }
      }
      .left,
      .right {
        display: flex;
        div {
          padding: 0px 10px;
          text-align: center;
          font-size: 18px;
          color: #3c3b3b;
        }
        .name {
          font-size: 14px;
          color: #424141;
        }
        .return {
          color: black;
        }
      }
    }
    .guide-nav {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      padding: 0px 16px;
      .box {
        width: 58px;
        height: 58px;
        line-height: 58px;
        text-align: center;
        margin: 12px 24px;
        div {
          position: relative;
          top: -33px;
          font-size: 14px;
        }
      }
    }
    .mybookshelf {
      margin: 20px 50px;
      text-align: center;
      padding: 8px 0px;
      font-size: 14px;
      color: white;
      font-weight: 500;
      background-color: #ed424b;
      border-radius: 20px;
    }
    .sw {
      font-size: 40px;
    }
  }
  .htear {
    width: 100%;
    display: flex;
    height: 22px;
    padding: 11px 0px 10px 0px;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e8e7e7;
    .left,
    .right {
      display: flex;
      div {
        padding: 0px 10px;
        text-align: center;
        font-size: 18px;
        color: #3c3b3b;
      }
      .name {
        font-size: 14px;
        color: #424141;
      }
      .return {
        color: black;
      }
    }
    .age {
      display: flex;
      height: 24px;
      border: 1px solid #ed424b;
      border-radius: 3px;
      div {
        font-size: 15px;
        line-height: 24px;
        color: #ed424b;
        padding: 0px 10px;
      }
      .com {
        background: #ed424b;
        color: white;
      }
    }
  }
  .content {
    .classcontent {
      width: 100%;
      .topnav {
        margin-left: 16px;
        display: flex;
        align-items: center;
        border-bottom: 1px solid #e8e7e7;
        padding: 10px 0px;
        .name {
          font-size: 16px;
          font-weight: 600;
          color: #33373d;
        }
        span {
          font-size: 13px;
          color: #969ba3;
          margin-left: 8px;
        }
        .icon-arrowRight-copy-copy-copy {
          position: absolute;
          right: 12px;
        }
      }
      .classlabel {
        margin-left: 16px;
        padding-bottom: 20px;
        ul {
          display: flex;
          flex-wrap: wrap;
          li {
            font-size: 13px;
            color: #969BA3;
            border-radius: 15px;
            border: 1px solid #969BA3;
            padding: 5px 12px;
            margin: 10px 10px 0px 0px;
          }
        }
      }
    }
  }
}
</style>